define (require)->

    $ = require('jquery')

    $container = $('body')

    eo={}

#todo:scroll
    eo.height = ($box, action, $view)->
        $view = $container if !$view
        if action=="up"||action=="left"
            if $view[0].scrollTop + window.innerHeight  < $box.offset().top + $box[0].offsetHeight
                #$view.animate scrollTop: $view[0].scrollTop + $box.offset().top + $box[0].offsetHeight - (window.innerHeight + $view[0].scrollTop)
                $view.scrollTop $view[0].scrollTop + $box.offset().top + $box[0].offsetHeight - (window.innerHeight + $view[0].scrollTop)
            else if $view[0].scrollTop  > $box.offset().top
                # $view.animate scrollTop: $box.offset().top
                $view.scrollTop $box.offset().top
        else
            if $view[0].scrollTop + window.innerHeight  < $box.offset().top + $box[0].offsetHeight
                #$view.animate scrollTop: $view[0].scrollTop + $box.offset().top + $box[0].offsetHeight - (window.innerHeight + $view[0].scrollTop)
                $view.scrollTop $view[0].scrollTop + $box.offset().top + $box[0].offsetHeight - (window.innerHeight + $view[0].scrollTop)
            else if $view[0].scrollTop  > $box.offset().top
                # $view.animate scrollTop: $box.offset().top
                $view.scrollTop $box.offset().top

    eo.left = (value, $view)->
        $view = $container if !$view
        if action=="up"||action=="left"
            $view.animate scrollLeft: $box.offset().left
        else
            if $view[0].scrollLeft + window.innerHeight < $box.offset().left + $box[0].offsetWidth
                $view.animate scrollLeft: $view[0].scrollLeft + $box[0].offsetWidth
    eo